﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>活动报名</title>
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="/CSS/V3/animate.css" rel="stylesheet">
    <link href="/CSS/V3/style.css?v=2.2.0" rel="stylesheet">
    <link href="/CSS/V3/BaseClassV3.css" rel="stylesheet" />
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script type="text/javascript" src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <style>
        .faq-answer {
            background: #FFFFFF;
        }
            
        .faq-question {
            color: #808080;
        }

            .faq-question:hover {
                color: #808080;
            }


        blockquote {
            font-size: 16px;
            margin: 0 0 10px;
        }
    </style>
    <script>
        var model = avalon.define({
            $id: "APP_HDBM",
            CommonData: [],
            username: ComFunJS.getnowuser(),
            SearchContent: "",
            HDBMType: 0,
            HDCount: "",
            AddHDBM: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=HDBM", "添加数据", "1100", "600");
            },
            GetHDBMDataList: function (type) {
                if (type != null) {
                    model.HDBMType = type;
                }
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERHDBMLIST', { P1: model.SearchContent, P2: model.HDBMType }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                        model.CommonData.forEach(function (item, i) {
                            if (item.FileList.length == 0) {
                                item.FileList = [];
                            }
                        })
                        if (!model.HDCount) {
                            model.HDCount = model.CommonData.size() > 0 ? model.CommonData.size() : "";
                        }
                    }
                })

            },
            AddHDBMItem: function (item) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=HDBMITEM&HDID=" + item.ID, "报名", "680", "350");
            },
            HDBMItemView: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_HDBM_ItemView.html?ID=" + ID, "查看已报名人员", "1000", "600");
            },
            AddPL: function (item, dom) {
                var plcontent = dom.val();
                if ($.trim(plcontent) == "") {
                    parent.ComFunJS.winwarning("请输入批注内容");
                    return;
                }
                $.post('/API/FTAPI.ashx?Action=ADDCOMENT', { "P1": plcontent, "MsgType": "HDBM", "MsgLYID": item.ID }, function (result) {
                    var result = $.parseJSON(result);
                    if (result.ErrorMsg == "") {
                        item.PLList.push(result.Result)
                        dom.val("")
                    }
                })
            },
            jptj: function (event, item, dom) {
                if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
                    model.AddPL(item, dom);
                }
            },
            EditHDBM: function (Id) {
                parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_ADD_WF.html?FormCode=HDBM&ID=" + Id, "添加数据", "1000", "");
            },
            DELHDBM: function (item) {
                parent.ComFunJS.winconfirm("确认要删除么", function () {
                    $.post("/API/FTAPI.ashx", { Action: "DELHDBMMODEL", P1: item.ID }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if (jsonresult.ErrorMsg == "") {
                            parent.ComFunJS.winsuccess("删除成功");
                            model.CommonData.remove(item);
                        } else { 
                            parent.ComFunJS.winwarning(jsonresult.ErrorMsg);
                        }
                    })
                })
            }
        });


        avalon.ready(function () {
            ComFunJS.initsetajax();
            model.GetHDBMDataList();
        })

    </script>
</head>
<body class="gray-bg" ms-controller="APP_HDBM">
    <div class="wrapper wrapper-content  animated fadeInRight">
        <div class="row">
            <div class="col-sm-3">
                <div class="float-e-margins">
                    <div class="ibox-content" style="border: none; border-right: 1px solid #e7eaec;">
                        <div class="file-manager">
                            <div class="hr-line-dashed"></div>
                            <button class="btn btn-primary btn-block" ms-click="AddHDBM()">添加活动报名</button>
                            <div class="hr-line-dashed"></div>
                            <h5>显示：</h5>
                            <button class="btn  btn-sm" ms-class-1="btn-primary:model.HDBMType==0" ms-class-2="btn-white:model.HDBMType!=0" ms-click="GetHDBMDataList(0)" type="button">全部状态</button>
                            <button class="btn  btn-sm" ms-class-1="btn-primary:model.HDBMType==1" ms-class-2="btn-white:model.HDBMType!=1" type="button" ms-click="GetHDBMDataList(1)">正在进行</button>
                            <button class="btn  btn-sm" ms-class-1="btn-primary:model.HDBMType==2" ms-class-2="btn-white:model.HDBMType!=2" type="button" ms-click="GetHDBMDataList(2)">已结束</button>
                            <div class="hr-line-dashed"></div>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-9">
                <div>
                    <div class="pull-right mail-search">
                        <div class="input-group">
                            <input type="text" class="input form-control" ms-duplex="SearchContent" placeholder="输入活动内容或标题查询">
                            <span class="input-group-btn">
                                <button type="button" class="btn btn btn-primary" ms-click="GetHDBMDataList(null)"> <i class="fa fa-search"></i> 搜索</button>
                            </span>
                        </div>
                    </div>
                    <h2>
                        活动报名
                    </h2>
                    <div class="mail-tools tooltip-demo m-t-md">
                        <div class="btn-group pull-right">
                            <div id="pageDiv" class="text-right"></div>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div class="panel-collapse  faq-answer" style="font-size:14px;" ms-repeat-item="CommonData">
                    <div class="row">
                        <div class="col-md-8" style="word-break:break-all;">
                            <h3>【发起方：{{item.HDFQF}}】{{item.HDTitle}}</h3>
                        </div>
                        <div class="col-md-4 text-right">
                            <a class=" btn btn-primary btn-xs btntool" ms-if="item.CRUser==username" ms-click="EditHDBM(item.ID)"><i class="fa fa-pencil"></i> 编辑 </a>
                            <a class="btn btn-danger btn-xs btntool" style="margin-right:15px" ms-if="item.CRUser==username" ms-click="DELHDBM(item)"><i class="fa fa-trash-o"></i> 删除 </a>
                            <span class="font-noraml">{{ComFunJS.convertuser(item.CRUser)}}</span>
                            <span class="font-noraml">{{item.CRDate|date("yyyy-MM-dd")}} </span>
                            <a class="btn btn-white btn-xs" data-toggle="collapse" ms-attr-href="'#faq'+item.ID"><i class="fa fa-angle-down"></i> </a>
                        </div>
                    </div>
                    <blockquote>
                        <span ms-html="item.HDContent" style="word-break:break-all;"></span>
                        <footer>活动内容 </footer>
                    </blockquote>
                    <div class="row">
                        <div class="col-xs-4">
                            <blockquote>
                                <p style="word-break:break-all;">{{item.HDAdress}}</p>
                                <footer>活动地址 </footer>
                            </blockquote>
                        </div>
                        <div class="col-xs-4">
                            <blockquote>
                                <p>{{item.HDTime|date("yyyy-MM-dd")}}</p>
                                <footer>活动时间 </footer>
                            </blockquote>
                        </div>
                        <div class="col-xs-4">
                            <blockquote>
                                <p>{{item.HDBMEndTime|date("yyyy-MM-dd")}}</p>
                                <footer>报名截至时间 </footer>
                            </blockquote>
                        </div>
                        <div class="col-xs-12" style="margin-left:10px;">
                            <button class="btn btn-info" ms-click="AddHDBMItem(item)" ms-if="ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), item.HDBMEndTime.substring(0,10))>=0"> {{item.itemUser==""||item.itemUser==null?"我要报名":"已报名"}}</button><a href="#" style="margin-left:10px" ms-click="HDBMItemView(item.ID)">查看已报名人员</a>
                        </div>
                    </div>
                    <div class="social-footer collapse" ms-attr-id="'faq'+item.ID" style="margin-top:5px;">
                        <div class="social-comment">
                            <div class="media-body">
                                <label ms-if="item.FileList!=null&&item.FileList.size()>0" style=" margin-left:20px;"> 附件：</label><a style="margin-left:10px" ms-repeat-files="item.FileList" target="_blank" download="filename" ms-attr-href="'/View/Common/DownLoadFile.aspx?MD5='+files.FileMD5">{{files.Name+'.'+files.FileExtendName}}</a>
                            </div>
                        </div>
                        <div class="social-comment" ms-repeat-el="item.PLList">
                            <a href="" class="pull-left">
                                <img alt="image" ms-attr-src="'/Upload/TX/'+el.CRUser+'.jpg'" style="width:32px;height:32px" onerror="javascript: this.src = '/images/TX/default.png'" />
                            </a>
                            <div class="media-body">
                                <a href="#">
                                    {{el.CRUserName}}
                                </a> {{el.MSGContent}}
                                <br />
                                <!--<a href="#" class="small"><i class="fa fa-thumbs-up"></i> 26</a>--> -
                                <small class="text-muted">{{el.CRDate|date("MM月dd日 HH:mm")}}</small>
                            </div>
                        </div>
                        <div class="social-comment">
                            <a href="" class="pull-left">
                                <img alt="image" ms-attr-src="'/Upload/TX/'+username+'.jpg'" style="width:32px;height:32px" onerror="javascript: this.src = '/images/TX/default.png'" />
                            </a>
                            <div class="media-body">
                                <div class="input-group">
                                    <input type="text" class="form-control" ms-keypress="jptj(event,item,$(this))" placeholder="此处添加批注(按Ctrl+Enter直接提交)" />
                                    <span class="input-group-btn">
                                        <button type="button" class="btn btn btn-primary" autocomplete="off" ms-on-click="AddPL(item,$(this).parent().parent().find('input'))">添加评论</button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
